home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Oberon⁄F™ 1.2 / Preinstalled version / System / Docu / Fonts (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-07-08  |  14.7 KB  |  208 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. TextRulers.StdRulerDesc
  17. TextRulers.RulerDesc
  18. TextRulers.StdStyleDesc
  19. TextRulers.StyleDesc
  20. TextRulers.AttributesDesc
  21. Helvetica
  22. Helvetica
  23. Helvetica
  24. Helvetica
  25. HostPictures.StdViewDesc
  26. Geneva
  27. N    base line
  28. ascent
  29. descent
  30. +xO    base line
  31. ascent
  32. descent
  33. Helvetica
  34. Fonts
  35. DEFINITION Fonts;
  36.     CONST
  37.         mm = 36000;
  38.         point = LONG(12700);
  39.         italic = 0; underline = 1; strikeout = 2;
  40.         normal = 400; bold = 700;
  41.     TYPE
  42.         LONGCHAR = INTEGER;
  43.         Typeface = ARRAY 32 OF CHAR;
  44.         TypefaceInfo = POINTER TO RECORD
  45.             next: TypefaceInfo;
  46.             typeface: Typeface
  47.         END;
  48.         Font = POINTER TO FontDesc;
  49.         FontDesc = RECORD
  50.             typeface-: Typeface;
  51.             size-: LONGINT;
  52.             style-: SET;
  53.             weight-: INTEGER;
  54.             asc, dsc: LONGINT;
  55.             w: LONGINT;
  56.             fingerprint: LONGINT;
  57.             PROCEDURE (f: Font) Init (typeface: Typeface; size: LONGINT;
  58.                                                         style: SET; weight: INTEGER;
  59.                                                         asc, dsc, w, fingerprint: LONGINT);
  60.             PROCEDURE (f: Font) StringWidth (s: ARRAY OF CHAR): LONGINT;
  61.             PROCEDURE (f: Font) LStringWidth (s: ARRAY OF LONGCHAR): LONGINT;
  62.             PROCEDURE (f: Font) IsAlien (): BOOLEAN
  63.         END;
  64.         Directory = POINTER TO DirectoryDesc;
  65.         DirectoryDesc = RECORD
  66.             PROCEDURE (d: Directory) This (typeface: Typeface; size: LONGINT;
  67.                                                                 style: SET; weight: INTEGER): Font;
  68.             PROCEDURE (d: Directory) Default (): Font;
  69.             PROCEDURE (d: Directory) TypefaceList (): TypefaceInfo
  70.         END;
  71.     VAR dir-, stdDir-: Directory;
  72.     PROCEDURE SetDir (d: Directory);
  73. END Fonts.
  74. A font is a collection of character glyphs, i.e. a collection of distinct visual representations of characters. Visual representations of the same character may differ in size (e.g. 12 point vs. 16 point), style (e.g. plain vs. italic), typeface (e.g. Times vs. Helvetica), and weight (e.g. bold vs. normal).
  75. In Oberon, most distances are measured in universal units. Several important distance values in these units are defined below:
  76.  um    = 36    micrometer
  77.  mm    = 36000    millimeter
  78.  cm    = 10 * mm    centimeter
  79.  m    = 1000 * mm    meter
  80.  inch    = 914400    inch
  81. Font sizes are measured in these universal units as well. The following values are used in connection with font sizes:
  82.  point    = 12700    1/72 inch    (desktop publishing point)
  83.  pica    = 12636    0.351 mm
  84.  didot    = 13500    0.375 mm
  85.  cicero    = 163800    4.55 mm
  86. However, it should be mentioned that in modern typography the millimeter is the dominating measure, followed by the point as established in desktop publishing software.
  87. Module Fonts provides an abstract type Font, which mainly allows to measure the widths of characters and strings in universal units. These measures are completely device-independent. There is no device-specific information (e.g. character bitmap) in a font object. Font objects are only used for measurements and for the identification of a font. In the latter capacity, they can be passed as parameters to output routines. These output routines generate or access (device-dependent) character bitmaps in a way not specified by Oberon.
  88. An application need not be aware whether font bitmaps are stored permanently ("bitmapped fonts") or whether they are generated on demand (using "outline fonts").
  89. The meanings of two important font metrics, namely ascent and descent, are illustrated in the following diagram:
  90. Picture a:  Base Line, Ascent, Descent
  91. Characters of a word are placed side by side on a so-called base line. The ascent measures how far any character of a font may extend above the base line. The descent measures how far any character of a font may extend below the base line. The line spacing is the sum of ascent and descent.
  92. In Oberon, the ascent must be large enough to accomodate oversized characters plus the minimal required distance between lines. Thus the ascent includes "line gap", "internal leading", and "external leading" as defined in other font models.
  93. Not all character codes need to be represented in a font. A character which is not represented in a font is displayed by a special "missing" symbol, e.g. an empty rectangle. Alternatively, Oberon may use another font to display the character.
  94. It is often desirable to display text on the screen in a way which is similar to the way it is printed on paper. This is known as WYSIWYG display (What You See Is What You Get). However, there are several factors which make true WYSIWYG display a problematic proposition.
  95. The most fundamental problem is the large difference between today's screen and printer resolutions. Screens have typical spatial resolutions of about 70 to 100 dpi (dot per inch), while laser printers have resolutions of at least 300 dpi. This large difference forces the programmer to decide whether
  96. - to tune text drawing for maximal legibility on screen, and thereby giving up device-independence and reducing the quality of hard copy, or
  97. - to tune text drawing for maximal precision, which results in reduced legibility on screen due to rounding effects, or
  98. - to give up the strict WYSIWYG requirements to some degree.
  99. All three solutions have their merits and problems, and all three solutions can be found in commercial word processors.
  100. Another problem for pure WYSIWYG display is that not all fonts are available on every machine. This means that a document containing a particular font cannot be shown correctly on a computer where this font is not installed. In order to make it possible to open a document containing such a missing font (without converting this font permanently) a mechanism is provided in Oberon to temporarily substitute a place holder for a missing font, a so-called "alien" font.
  101. A font can be looked up in a font directory. Module Fonts provides an abstract type Directory for this purpose. If the directory cannot find a font, it creates an alien font object. An alien font internally uses an existing font for measurements and display, such that it can be used like any other font.
  102. An application which needs a font but has no preferences should use the default font. The default font is a system- or user-made choice out of one of the available fonts. The identity of the default font may vary over time.
  103. CONST mm, point
  104. These are the most important font size measures in universal units.
  105. CONST italic, underline, strikeout
  106. Three standard font attributes.
  107. CONST normal, bold
  108. Two major font weights.
  109. TYPE LONGCHAR
  110. Type for 2-byte characters in the Unicode character set.
  111. TYPE Typeface
  112. String type for the typeface name of a font.
  113. TYPE TypefaceInfo
  114. This type gives the name of an available typeface. Typeface info records are connected in a linear list. No ordering is defines.
  115. TYPE Font
  116. Interface
  117. This is the base type for fonts, which allows to identify fonts and to measure font information in universal units.
  118. Fonts are allocated by font directories.
  119. Fonts are used by models which contain formatted text, by views which draw text, and by commands which operate on text.
  120. Fonts are extended by Oberon, internally.
  121. typeface-: Typeface
  122. The font's typeface name.
  123. size-: LONGINT    size > 0
  124. The font's size in universal units.
  125. style-: SET    subset of {italic, underline, strikeout}
  126. The set of the font's style attributes.
  127. weight-: INTEGER    0 <= weigth <= 1000
  128. A font's weight, i.e. the thickness of the strokes.
  129. asc, dsc: LONGINT    asc >= 0  &  dsc >= 0
  130. The font's ascent and descent.
  131. w: LONGINT    w >= 0
  132. The width of the widest character in the font.
  133. fingerprint: LONGINT
  134. This value is needed to verify a font's version. It is used internally.
  135. PROCEDURE (f: Font) Init (typeface: Typeface; size: LONGINT; style: SET;
  136.                                                 weight: INTEGER; asc, dsc, w, fingerprint: LONGINT)
  137. Initialize font fields.
  138. Init is called by Oberon, internally.
  139. f.size = 0    20    font must not be initialized yet
  140. size > 0    21
  141. style is subset of {italic, underline, strikeout}    22
  142. 0 <= weight <= 1000    23
  143. asc >= 0    24
  144. dsc >= 0    25
  145. w >= 0    26
  146. f.fingerprint = fingerprint
  147. f.typeface = typeface  &  f.size = size  &  f.style = style  &  f.weight = weight
  148. f.asc = asc  &  f.dsc = dsc  &  f.w = w  &  f.size > 0
  149. PROCEDURE (f: Font) StringWidth (s: ARRAY OF CHAR): LONGINT
  150. Interface
  151. Measures the width of a string in universal units.
  152. StringWidth is used by models or views which need to format text.
  153. s is terminated by 0X    index trap
  154. result >= 0    width of string
  155. PROCEDURE (f: Font) LStringWidth (s: ARRAY OF LONGCHAR): LONGINT
  156. Interface
  157. Measures the width of a string in universal units.
  158. LStringWidth is used by models or views which need to format text.
  159. s is terminated by 0H    index trap
  160. result >= 0    width of string
  161. PROCEDURE (f: Font) IsAlien (): BOOLEAN
  162. Interface
  163. Tells whether f is an alien font.  An alien font is returned upon lookup of a font which cannot be found or generated. It is used as a place holder for the missing font. Alien fonts can be displayed, but their metrics are usually not the same as the correct font's metrics and their glyphs usually differ significantly from the correct font's glyphs.
  164. IsAlien is used in commands which inform users about the existence of alien fonts in a document.
  165. TYPE Directory
  166. Interface
  167. Directory for the lookup of fonts.
  168. Font directories are allocated by Oberon.
  169. Font directories are used in models, views, and commands which need to specify a font for later use.
  170. Font directories are extended by Oberon, internally.
  171. PROCEDURE (d: Directory) This (typeface: Typeface; size: LONGINT;
  172.                                                             style: SET; weight: INTEGER): Font
  173. Interface
  174. Returns the font with the attributes (typeface, size, style, weight). If the font information cannot be found or generated, an alien font is returned instead. An alien font has the requested attributes, even though a different font is actually used.
  175. If a font is requested which has the same attributes as another, previously requested font, the directory attempts to return the same font object (i.e. the same pointer value) as it did before. However, if a large number of fonts is used, it may happen that another font object is returned instead. Such an object has the same attributes and provides the same metrics and identical glyphs as the older font object.
  176. This is used to look up a font when specific font attributes are given.
  177. size > 0    20
  178. result # NIL
  179. result.typeface = typeface
  180. result.size = size
  181. result.style = style
  182. result.weight = weight
  183. PROCEDURE (d: Directory) Default (): Font
  184. Interface
  185. Returns the current default font.
  186. Default is used when a font is needed and no specific font attributes are desired.
  187. result # NIL
  188. PROCEDURE (d: Directory) TypefaceList (): TypefaceInfo
  189. Interface
  190. Returns information about the available typefaces. The result is a linear list of typeface names, in no particular order.
  191. VAR dir-, stdDir-: Directory    dir # NIL  &  stdDir # NIL
  192. Directories for the lookup of fonts.
  193. PROCEDURE SetDir (d: Directory)
  194. Assigns directory.
  195. SetDir is used in configuration routines.
  196. d # NIL    20
  197. stdDir' = NIL
  198.     stdDir = d
  199. stdDir' # NIL
  200.     stdDir = stdDir'
  201. dir = d
  202. TextControllers.StdCtrlDesc
  203. TextControllers.ControllerDesc
  204. Containers.ControllerDesc
  205. Controllers.ControllerDesc
  206. Helvetica
  207. Documents.ControllerDesc
  208.